define(
    ["PDUtilDir/grid", "PDUtilDir/util", "PDUtilDir/tool", "PDUtilDir/slidebar", "PDUtilDir/inputSelect", "PDUtilDir/fileupload/multiFileUpload", "Date", "DateCN", "css!DateCss"],
    function (Grid, Util, Tool, Slidebar, inputSelect, MFU) {
        function reserveSupportInit($scope, $compile) {
            return new reserveSupport($scope, $compile);
        };

        function reserveSupport($scope, $compile) {
            this.$scope = $scope;
            this.$compile = $compile;
        };
        reserveSupport.fn = reserveSupport.prototype;

        reserveSupport.fn.init = function (data) {
            var _this = this;
            _this.entity = $.extend(data, {
                carTypeName: _this.$scope.cache.typeMap.get(data.carType)
            });
        };

        reserveSupport.fn.digest = function () {
            this.$scope.$digest();
        };

        reserveSupport.fn.run = function (data) {
            var _this = this;
            _this.init(data);

            this.slidebars = Slidebar({
                size: 'lg',
                url: getServer()
                + "/static/app/fleet/cteamOrderInfos/views/reserve.html",
                $scope: this.$scope,
                $compile: this.$compile,
                afterLoad: function ($Panel) {
                    _this.initialization();
                    _this.digest();
                }
            });
        };
        reserveSupport.fn.initialization = function () {
            this.baseInit();
            this.carInfoInit();
        };
        reserveSupport.fn.baseInit = function () {};

        reserveSupport.fn.carInfoInit = function () {
            this.gird = Grid({
                id: "OrderDetailGirdDivId",
                pageSize: 10,
                index: true,
                multi: false,
                pagination: true,
                cache: false,
                layout : [ {
                    name : "车牌号",
                    field : "plateNumber",
                    sort : true
                }, {
                    name : "司机",
                    field : "driverName",
                    sort : true
                }, {
                    name : "司机电话",
                    field : "driverPhone"
                }, {
                    name : "创建时间",
                    field : "createTime"
                }],
                toolbar: [ ],
                data : {
                    type : "URL",
                    value : getServer()
                        + "/flea/hclv/car/reserve/getReserveCarItem.htmls"
                },
                queryParam: {
                    reserveCarId: this.entity.id
                }
            });
        };

        return reserveSupportInit;
    });